package com.design.pattern.strategy.entity;

import com.design.pattern.strategy.behavior.FlyWithRocket;
import com.design.pattern.strategy.behavior.NoFly;

/**
 * @author wangyingjie
 * @date 2018年10月12日14:51:29
 * @remark 模型鸭
 */
public class ModelDuck extends Duck {
    @Override
    public void display() {
        System.out.println("我是一只模型鸭");
    }

    public ModelDuck() {
        this.flyBehavior = new NoFly();
    }

    public static void main(String[] args) {
        ModelDuck modelDuck = new ModelDuck();
        //借助set具体行为实现类方法，来在运行途中改变具体行为
        modelDuck.performFly();
        modelDuck.setFlyBehavior(new FlyWithRocket());
        modelDuck.performFly();
    }
}
